package com.module.user.ui.me

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.common.app.data.bean.IntelligentTouchOptionModel
import com.common.app.data.bean.KeyPre
import com.common.app.data.bean.user.*
import com.common.app.data.repository.UserApi
import com.common.base.app.viewmodel.BaseViewModel
import com.common.base.data.CommonBean
import com.common.base.utils.AppUtils.getString
import com.common.base.utils.SpUtilsManagement
import com.module.ble.utils.LightingEffectConfig
import com.module.user.R

/**
 * 作者：sosou
 * <p>
 * 版本：1.0
 * <p>
 * 创建日期：2022/8/29
 * <p>
 * 描述：我的模块首页VM
 * <p>
 * 修订历史：
 */
class MeViewModel : BaseViewModel() {

    var intelligentTouchOptionData = MutableLiveData<List<IntelligentTouchOptionModel>>()

    init {
        val mTempList = mutableListOf<IntelligentTouchOptionModel>()
        mTempList.add(IntelligentTouchOptionModel(LightingEffectConfig.TYPE_LIGHTING_TIMING,name = getString(R.string.user_timed_lighting_hint), hint = getString(R.string.user_ring_short_video_hint2), isSelect = SpUtilsManagement.getBoolean(KeyPre.KEY_LIGHTING_TIMING_VALUE,false)))
        mTempList.add(IntelligentTouchOptionModel(LightingEffectConfig.TYPE_LIGHTING_GESTURE,name = getString(R.string.user_gesture_lighting_hint), hint = getString(R.string.user_ring_music_hint2), isSelect = SpUtilsManagement.getBoolean(KeyPre.KEY_LIGHTING_GESTURE_VALUE,false)))
        mTempList.add(IntelligentTouchOptionModel(LightingEffectConfig.TYPE_LIGHTING_SPORTS,name = getString(R.string.user_sports_lighting_hint), hint = getString(R.string.user_ring_take_photos_hint2), isSelect = SpUtilsManagement.getBoolean(KeyPre.KEY_LIGHTING_SPORTS_VALUE,false)))
        intelligentTouchOptionData.value = mTempList
    }

    //获取用户信息
    fun getUserInfo(): LiveData<CommonBean<UserBean>> = emit({}) {
        UserApi.getUserInfo()
    }
}